/*
 * Written by Dustin Striplin
 */

package Model;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Conference {
	String name;
	Date  date;
	String venue;
	Date deadline;

	SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");

	String pc = "empty";

	/**
	 * Creates a conference
	 * @param a_name name of conference
	 * @param a_date date of conference in format ("MM/dd/yyyy")
	 * @param a_venue The venue
	 * @param a_deadline the deadline in format ("MM/dd/yyyy")
	 */
	public Conference(String a_name, String a_date, String a_venue, String a_deadline) {
		name = a_name;
		
		try {
			date = sdf.parse(a_date);
		} catch (ParseException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		venue = a_venue;
		try {
			deadline = sdf.parse(a_deadline);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	/**
	 * copy constructor
	 * @param toCopy
	 */
	public Conference(Conference toCopy) {
		this.name = toCopy.name;
		this.date = toCopy.date;
		this.venue = toCopy.venue;
		this.deadline = (Date) toCopy.deadline.clone();
	}

	/**
	 * 
	 * @return the conference name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 
	 * @param a_name set the name
	 */
	public void setName(String a_name) {
		name = a_name;
	}
	
	/**
	 * 
	 * @return the Date of the conference
	 */
	public String getDate() {
		return sdf.format(date);
	}
	
	/**
	 * 
	 * @return the venue
	 */
	public String getVenue() {
		return venue;
	}
	
	/**
	 * 
	 * @return the name of the program chair
	 */
	public String getPc() {
		return pc;
	}
	
	/**
	 * Sets the program chair for this conference
	 * @param a_pc
	 */
	public void setPc(String a_pc) {
		this.pc = a_pc; 
	}

	
	/**
	 * 
	 * @return The submissino deadline as a string
	 */
	public String getDeadline() {
		return sdf.format(deadline);
	}
	
	/**
	 * 
	 * @return the deadline as a date
	 */
	public Date getDeadlineDate() {
		return deadline;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Conference...");
		sb.append("name=");
		sb.append(name);
		sb.append(", date=");
		sb.append(date);
		sb.append(", venue=");
		sb.append(venue);
		sb.append(", Submission Deadline=");
		sb.append(deadline);
		return sb.toString();
	}
}